package net.lab1024.sa.admin.module.business.flow.service;

import jakarta.annotation.PostConstruct;
import lombok.Data;
import org.flowable.engine.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Data
public class FlowServiceFactory {

    @Autowired
    protected ProcessEngine processEngine;

    protected RepositoryService repositoryService;
    protected RuntimeService runtimeService;
    protected TaskService taskService;
    protected IdentityService identityService;
    protected ManagementService managementService;
    protected DynamicBpmnService dynamicBpmnService;
    protected HistoryService historyService;

    @PostConstruct
    public void initServices() {
        this.repositoryService = processEngine.getRepositoryService();
        this.runtimeService = processEngine.getRuntimeService();
        this.taskService = processEngine.getTaskService();
        this.identityService = processEngine.getIdentityService();
        this.managementService = processEngine.getManagementService();
        this.dynamicBpmnService = processEngine.getDynamicBpmnService();
        this.historyService = processEngine.getHistoryService();
    }
}
